//
//  NewsTableViewCell.m
//  10-CellSelf-Size-自适应高度
//
//  Created by 王道林 on 16/7/27.
//  Copyright © 2016年 王道林. All rights reserved.
//

#import "NewsTableViewCell.h"

@interface NewsTableViewCell ()
@property (nonatomic, strong) UILabel *label;
@end

@implementation NewsTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
   self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _label = [[UILabel alloc] init];
        _label.numberOfLines = 0;
        [self.contentView addSubview:_label];
        // cell  选中状态的风格
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    NSLog(@"%lf", self.contentView.frame.size.height);
    NSLog(@"%lf", self.frame.size.height);
    _label.frame = CGRectMake(0, 0, self.contentView.frame.size.width, self.contentView.frame.size.height);
}
-(void)setString:(NSString *)string
{
    _string = [string copy];
    _label.text = _string;
    
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
